table of contents
GIT-ARCHIVE(1) | Git Manual | GIT-ARCHIVE(1) |
NAME¶
git-archive - Create an archive of files from a named tree
SYNOPSIS¶
git archive [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
[-o | --output=<file>] [--worktree-attributes]
[--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
[path...]
DESCRIPTION¶
Creates an archive of the specified format containing the tree structure for the named tree, and writes it out to the standard output. If <prefix> is specified it is prepended to the filenames in the archive.
git archive behaves differently when given a tree ID versus when given a commit ID or tag ID. In the first case the current time is used as the modification time of each file in the archive. In the latter case the commit time as recorded in the referenced commit object is used instead. Additionally the commit ID is stored in a global extended pax header if the tar format is used; it can be extracted using git get-tar-commit-id. In ZIP files it is stored as a file comment.
OPTIONS¶
--format=<fmt>
-l, --list
-v, --verbose
--prefix=<prefix>/
-o <file>, --output=<file>
--worktree-attributes
<extra>
--remote=<repo>
--exec=<git-upload-archive>
<tree-ish>
path
BACKEND EXTRA OPTIONS¶
zip¶
-0
-9
CONFIGURATION¶
tar.umask
ATTRIBUTES¶
export-ignore
export-subst
Note that attributes are by default taken from the .gitattributes files in the tree that is being archived. If you want to tweak the way the output is generated after the fact (e.g. you committed without adding an appropriate export-ignore in its .gitattributes), adjust the checked out .gitattributes file as necessary and use --work-tree-attributes option. Alternatively you can keep necessary attributes that should apply while archiving any tree in your $GIT_DIR/info/attributes file.
EXAMPLES¶
git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)
git archive --format=tar --prefix=git-1.4.0/ v1.4.0 | gzip >git-1.4.0.tar.gz
git archive --format=tar --prefix=git-1.4.0/ v1.4.0^{tree} | gzip >git-1.4.0.tar.gz
git archive --format=zip --prefix=git-docs/ HEAD:Documentation/ > git-1.4.0-docs.zip
git archive -o latest.zip HEAD
SEE ALSO¶
AUTHOR¶
Written by Franck Bui-Huu and Rene Scharfe.
DOCUMENTATION¶
Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org[1]>.
GIT¶
Part of the git(1) suite
NOTES¶
- 1.
- git@vger.kernel.org
02/03/2020 | Git 1.7.1 |